package com.chainyoung.component_tmperson.ui.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.chainyoung.common.utils.StringUtil;
import com.chainyoung.component_tmperson.R;
import com.chainyoung.component_tmperson.entity.WalletRepayment;

import java.util.List;

public class WalletRepaymentScheduleAdapter extends BaseQuickAdapter<WalletRepayment, BaseViewHolder> {

    private String coin;

    public WalletRepaymentScheduleAdapter(@Nullable List<WalletRepayment> data,String coin) {
        super(R.layout.layout_repayment_schedule_item, data);
        this.coin=coin;
    }


    @Override
    protected void convert(BaseViewHolder helper, WalletRepayment item) {
        helper.setText(R.id.tv_time, item.getRepay_date());
        helper.setText(R.id.tv_amount, StringUtil.subZeroAndDot(item.getInterests().add(item.getPrincipal()) + coin.toUpperCase()));
        helper.setText(R.id.tv_detail, "本金" + StringUtil.subZeroAndDot(String.valueOf(item.getPrincipal())) + "+" + "利息" + StringUtil.subZeroAndDot(String.valueOf(item.getInterests())));
    }


}
